namespace Umdf.ComInterop
{
    using System;
    using System.Runtime.CompilerServices;
    using System.Runtime.InteropServices;
    using System.Security.Principal;

    [ComImport, ComConversionLoss, InterfaceType((short) 1), Guid("2082260D-0E28-4C57-B5C2-67FA091DAA91")]
    public interface ISideShowDriver
    {
        [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
        void OnGetDeviceName([MarshalAs(UnmanagedType.LPWStr)] out string ppwszName);

        [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
        void OnGetDeviceManufacturer([MarshalAs(UnmanagedType.LPWStr)] out string ppwszManufacturer);

        [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
        void OnGetDeviceFirmwareVersion([MarshalAs(UnmanagedType.LPWStr)] out string ppwszVersion);

        [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
        void OnSetTime([In] System.Runtime.InteropServices.ComTypes.FILETIME FileTime);

        [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
        void OnSetTimeZone([In] ref SideShowTimeZoneInformation pTimeZoneInformation);

        [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
        void OnSetCurrentUser([In] IntPtr pUserSid);

        [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
        void OnGetCurrentUser([Out] out IntPtr ppUserSid);

        [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
        void OnSetUserState(
            [In] IntPtr pUserSid, 
            [In] UserState state);

        [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
        void OnSetShortDateFormat(
            [In] IntPtr pUserSid, 
            [In, MarshalAs(UnmanagedType.LPWStr)] string pwszDateFormat);

        [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
        void OnSetLongDateFormat(
            [In] IntPtr pUserSid, 
            [In, MarshalAs(UnmanagedType.LPWStr)] string pwszDateFormat);

        [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
        void OnSetShortTimeFormat(
            [In] IntPtr pUserSid, 
            [In, MarshalAs(UnmanagedType.LPWStr)] string pwszTimeFormat);

        [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
        void OnSetLongTimeFormat(
            [In] IntPtr pUserSid, 
            [In, MarshalAs(UnmanagedType.LPWStr)] string pwszTimeFormat);

        [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
        void OnSetLanguage(
            [In] IntPtr pUserSid, 
            [In, MarshalAs(UnmanagedType.LPWStr)] string pwszLanguage);

        [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
        void OnGetDeviceEndpoints(
            [Out] out IntPtr rgEndpoints, 
            out uint pcEndpoints);

        [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
        void OnGetDeviceCapabilities(
            [In] ref PropertyKey pKey, 
            out PropVariant pvValue);

        [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
        void OnGetPreEnabledApplications(
            [Out] out IntPtr ppApplicationIds,
            [Out] out IntPtr ppEndpointIds, 
            out uint pcApplications);

        [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
        void OnSetApplicationOrder(
            [In] Guid[] pApplicationIds, 
            [In] uint cApplicationIds);

        [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
        void OnGetApplicationOrder(
            [Out] out IntPtr ppApplicationIds, 
            out uint pcApplicationIds);
        
        [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
        void OnAddApplication(
            [In] IntPtr pUserSid, 
            [In] ref Guid ApplicationId, 
            [In] ref Guid EndPointId, 
            [In, MarshalAs(UnmanagedType.LPWStr)] string pcwszName, 
            [In] uint dwCachePolicy, 
            [In] uint dwOnlineOnly, 
            [In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex=7)] byte[] pbLargeIcon, 
            [In] uint cbLargeIcon,
            [In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 9)] byte[] pbMediumIcon, 
            [In] uint cbMediumIcon,
            [In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 11)] byte[] pbSmallIcon, 
            [In] uint cbSmallIcon);
        
        [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
        void OnRemoveApplication(
            [In] IntPtr pUserSid, 
            [In] ref Guid ApplicationId);

        [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
        void OnRemoveAllApplications(
            [In] IntPtr pUserSid);
        
        [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
        void OnAddContent(
            [In] IntPtr pUserSid, 
            [In] ref Guid ApplicationId, 
            [In] ref Guid EndPointId, 
            [In] uint ContentId, [In] IntPtr pData, 
            [In] uint cbData);
        
        [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
        void OnRemoveContent(
            [In] IntPtr pUserSid, 
            [In] ref Guid ApplicationId, 
            [In] ref Guid EndPointId, 
            [In] uint ContentId);
        
        [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
        void OnRemoveAllContent(
            [In] IntPtr pUserSid, 
            [In] ref Guid ApplicationId, 
            [In] ref Guid EndPointId);

        [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
        void OnAddNotification(
            [In] IntPtr pUserSid, 
            [In] ref Guid ApplicationId, 
            [In] uint NotificationId, 
            [In] System.Runtime.InteropServices.ComTypes.FILETIME ftExpiration, 
            [In, MarshalAs(UnmanagedType.LPWStr)] string pcwszTitle, 
            [In, MarshalAs(UnmanagedType.LPWStr)] string pcwszMessage,
            [In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 7)] byte[] pbImage, 
            [In] uint cbImage);

        [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
        void OnRemoveNotification(
            [In] IntPtr pUserSid, 
            [In] ref Guid ApplicationId, 
            [In] uint NotificationId);

        [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
        void OnRemoveAllNotifications(
            [In] IntPtr pUserSid, 
            [In] ref Guid ApplicationId);

        [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
        void OnSetNotificationsEnabled(
            [In] IntPtr pUserSid, 
            [In] int fIsEnabled);

        [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
        void OnProcessWpdMessage(
            [In, MarshalAs(UnmanagedType.IUnknown)] object pPortableDeviceValuesParams, 
            [In, MarshalAs(UnmanagedType.IUnknown)] object pPortableDeviceValuesResults);
    }
}

